package com.sgj.controller;

import com.sgj.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author 沈国纪
 * @date 2021/4/4 23:43
 */
@Controller
public class ArchiveShowController {

	private static final String ARCHIVE = "archives";

	@Autowired
	private BlogService blogService;

	/**
	 * 归档页面查询
	 * @param model
	 * @return
	 */
	@GetMapping("/archives")
	public String archives(Model model) {
		model.addAttribute("archiveMap", blogService.archiveBlog());
		model.addAttribute("blogCount", blogService.countBlog());
		return ARCHIVE;
	}
}
